﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Data;

public partial class _1_5 : System.Web.UI.Page
{
    SqlConnection sqlcon;
    string strCon = WebConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            sqlcon = new SqlConnection(strCon);
            sqlcon.Open();

            //煤炭合计
            SqlCommand sqlcmd = new SqlCommand("select * from a01105 where CODE ='110' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"], sqlcon);
            SqlDataReader reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldMT_HJ.Value = "edit";
                TextBoxMT_HJ.Text = reader["COAL_num"].ToString();
            }
            reader.Close();

            //燃料煤
            sqlcmd.CommandText = "select * from a01105 where CODE ='902' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldRLM.Value = "edit";
                TextBoxRLM_XHL.Text = reader["COAL_num"].ToString();
                TextBoxRLM_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxRLM_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();

            //原料煤
            sqlcmd.CommandText = "select * from a01105 where CODE ='901' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldYLM.Value = "edit";
                TextBoxYLM_XHL.Text = reader["COAL_num"].ToString();
                TextBoxYLM_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxYLM_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();

            //其他固体燃料
            sqlcmd.CommandText = "select * from a01105 where CODE ='190' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldGTRL.Value = "edit";
                TextBoxGTRL_XHL.Text = reader["COAL_num"].ToString();
                TextBoxGTRL_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxGTRL_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();

            //油类燃料合计
            sqlcmd.CommandText = "select * from a01105 where CODE ='903' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldYL_HJ.Value = "edit";
                TextBoxYL_HJ.Text = reader["COAL_num"].ToString();
            }
            reader.Close();

            //重油
            sqlcmd.CommandText = "select * from a01105 where CODE ='312' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldZY.Value = "edit";
                TextBoxZY_XHL.Text = reader["COAL_num"].ToString();
                TextBoxZY_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxZY_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();

            //柴油
            sqlcmd.CommandText = "select * from a01105 where CODE ='317' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldCY.Value = "edit";
                TextBoxCY_XHL.Text = reader["COAL_num"].ToString();
                TextBoxCY_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxCY_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();

            //其他油类
            sqlcmd.CommandText = "select * from a01105 where CODE ='500' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldQTYL.Value = "edit";
                TextBoxQTYL_XHL.Text = reader["COAL_num"].ToString();
                TextBoxQTYL_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxQTYL_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();

            //其他液体
            sqlcmd.CommandText = "select * from a01105 where CODE ='390' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldQTYT.Value = "edit";
                TextBoxQTYT_XHL.Text = reader["COAL_num"].ToString();
                TextBoxQTYT_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxQTYT_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();

            //天然气
            sqlcmd.CommandText = "select * from a01105 where CODE ='210' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldTRQ.Value = "edit";
                TextBoxTRQ_XHL.Text = reader["COAL_num"].ToString();
                TextBoxTRQ_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxTRQ_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();

            //其他气体
            sqlcmd.CommandText = "select * from a01105 where CODE ='290' and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"];
            sqlcon.Open();
            reader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                HiddenFieldQTQT.Value = "edit";
                TextBoxQTQT_XHL.Text = reader["COAL_num"].ToString();
                TextBoxQTQT_LF.Text = reader["OIL_NUM"].ToString();
                TextBoxQTQT_HF.Text = reader["GAS_NUM"].ToString();
            }
            reader.Close();


            sqlcon.Close();
        }
    }


    public string DisplayStr()
    {

        YingYongHanShu yyhs = new YingYongHanShu();

        return yyhs.DisplayStr2("101105");
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Page.IsValid) //当所有校验控件都正确是才提交
        {
            LabelTiShi.Text = "正在提交中，请不要关闭或离开...";
            LabelTiShi.Visible = true;

            sqlcon = new SqlConnection(strCon);
            sqlcon.Open();

            ZhuanHuan zh = new ZhuanHuan();//调用转换类

            //煤炭合计           
            string sqlstr = "";
            if (HiddenFieldMT_HJ.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',110,"
                    + Convert.ToString(zh.StrToDouble(TextBoxRLM_XHL.Text.Trim()) + zh.StrToDouble(TextBoxYLM_XHL.Text.Trim())) + ",0,0)";
            }
            else //修改
            {
                sqlstr = "update A01105 set " + "COAL_NUM="
                + Convert.ToString(zh.StrToDouble(TextBoxRLM_XHL.Text.Trim()) + zh.StrToDouble(TextBoxYLM_XHL.Text.Trim())) +
                " where CODE='110' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            SqlCommand sqlcmd = new SqlCommand(sqlstr, sqlcon);
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldMT_HJ.Value == "insert")
            {
                HiddenFieldMT_HJ.Value = "edit";
            }
            TextBoxMT_HJ.Text = Convert.ToString(zh.StrToDouble(TextBoxRLM_XHL.Text.Trim()) + zh.StrToDouble(TextBoxYLM_XHL.Text.Trim()));//解决提交页面刷新后变动回旧值得问题


            //燃料煤           
            sqlstr = "";
            if (HiddenFieldRLM.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',902,"
                    + Convert.ToString(zh.StrToDouble(TextBoxRLM_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxRLM_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxRLM_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxRLM_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxRLM_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxRLM_HF.Text.Trim()))
                + " where CODE='902' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldRLM.Value == "insert")
            {
                HiddenFieldRLM.Value = "edit";
            }


            //原料煤           
            sqlstr = "";
            if (HiddenFieldYLM.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',901,"
                    + Convert.ToString(zh.StrToDouble(TextBoxYLM_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxYLM_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxYLM_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxYLM_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxYLM_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxYLM_HF.Text.Trim()))
                + " where CODE='901' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldYLM.Value == "insert")
            {
                HiddenFieldYLM.Value = "edit";
            }

            //其他固体燃料           
            sqlstr = "";
            if (HiddenFieldGTRL.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',190,"
                    + Convert.ToString(zh.StrToDouble(TextBoxGTRL_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxGTRL_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxGTRL_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxGTRL_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxGTRL_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxGTRL_HF.Text.Trim()))
                + " where CODE='190' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldGTRL.Value == "insert")
            {
                HiddenFieldGTRL.Value = "edit";
            }


            //油类合计           
            sqlstr = "";
            if (HiddenFieldYL_HJ.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',903,"
                    + Convert.ToString(zh.StrToDouble(TextBoxZY_XHL.Text.Trim()) + zh.StrToDouble(TextBoxCY_XHL.Text.Trim()) + zh.StrToDouble(TextBoxQTYL_XHL.Text.Trim())) + ",0,0)";
            }
            else //修改
            {
                sqlstr = "update A01105 set " + "COAL_NUM="
                + Convert.ToString(zh.StrToDouble(TextBoxZY_XHL.Text.Trim()) + zh.StrToDouble(TextBoxCY_XHL.Text.Trim()) + zh.StrToDouble(TextBoxQTYL_XHL.Text.Trim())) +
                " where CODE='903' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldYL_HJ.Value == "insert")
            {
                HiddenFieldYL_HJ.Value = "edit";
            }
            TextBoxYL_HJ.Text = Convert.ToString(zh.StrToDouble(TextBoxZY_XHL.Text.Trim()) + zh.StrToDouble(TextBoxCY_XHL.Text.Trim()) + zh.StrToDouble(TextBoxQTYL_XHL.Text.Trim()));//解决提交页面刷新后变动回旧值得问题



            //重油           
            sqlstr = "";
            if (HiddenFieldZY.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',312,"
                    + Convert.ToString(zh.StrToDouble(TextBoxZY_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxZY_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxZY_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxZY_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxZY_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxZY_HF.Text.Trim()))
                + " where CODE='312' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldZY.Value == "insert")
            {
                HiddenFieldZY.Value = "edit";
            }




            //柴油           
            sqlstr = "";
            if (HiddenFieldCY.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',317,"
                    + Convert.ToString(zh.StrToDouble(TextBoxCY_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxCY_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxCY_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxCY_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxCY_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxCY_HF.Text.Trim()))
                + " where CODE='317' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldCY.Value == "insert")
            {
                HiddenFieldCY.Value = "edit";
            }


            //其他油类           
            sqlstr = "";
            if (HiddenFieldQTYL.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',500,"
                    + Convert.ToString(zh.StrToDouble(TextBoxQTYL_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxQTYL_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxQTYL_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTYL_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTYL_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTYL_HF.Text.Trim()))
                + " where CODE='500' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldQTYL.Value == "insert")
            {
                HiddenFieldQTYL.Value = "edit";
            }


            //其他液体燃料          
            sqlstr = "";
            if (HiddenFieldQTYT.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',390,"
                    + Convert.ToString(zh.StrToDouble(TextBoxQTYT_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxQTYT_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxQTYT_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTYT_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTYT_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTYT_HF.Text.Trim()))
                + " where CODE='390' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldQTYT.Value == "insert")
            {
                HiddenFieldQTYT.Value = "edit";
            }




            //天然气          
            sqlstr = "";
            if (HiddenFieldTRQ.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',210,"
                    + Convert.ToString(zh.StrToDouble(TextBoxTRQ_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxTRQ_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxTRQ_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxTRQ_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxTRQ_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxTRQ_HF.Text.Trim()))
                + " where CODE='210' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldTRQ.Value == "insert")
            {
                HiddenFieldTRQ.Value = "edit";
            }



            //其他气体燃料         
            sqlstr = "";
            if (HiddenFieldQTQT.Value == "insert") //新增
            {
                sqlstr = "INSERT dbo.A01105( qiyeid ,DATA_YEAR,CODE,COAL_NUM,OIL_NUM,GAS_NUM)";
                sqlstr = sqlstr + " VALUES  (" + Session["qiyeid"] + ",'" + Session["ShenBaoNianDu"] + "',290,"
                    + Convert.ToString(zh.StrToDouble(TextBoxQTQT_XHL.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxQTQT_LF.Text.Trim())) + "," + Convert.ToString(zh.StrToDouble(TextBoxQTQT_HF.Text.Trim())) + ")";
            }
            else //修改
            {
                sqlstr = "update A01105 set "
                + "COAL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTQT_XHL.Text.Trim()))
                + ",OIL_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTQT_LF.Text.Trim()))
                + ",GAS_NUM=" + Convert.ToString(zh.StrToDouble(TextBoxQTQT_HF.Text.Trim()))
                + " where CODE='290' and qiyeid=" + Session["qiyeid"] + " and  DATA_YEAR='" + Session["ShenBaoNianDu"] + "'";
            };

            sqlcmd.CommandText = sqlstr;
            sqlcmd.ExecuteNonQuery();

            if (HiddenFieldQTQT.Value == "insert")
            {
                HiddenFieldQTQT.Value = "edit";
            }



            sqlcon.Close();
            LabelTiShi.Visible = false;
            MessageBox("tishi", "你所填写申报内容正确，已成功提交!");
        }
    }


    //// <summary> 
    /// 弹出提示信息框 
    /// </summary> 
    /// <param name="strKey">函数key值</param> 
    /// <param name="strInfo">提示信息</param> 
    public void MessageBox(string strKey, string strInfo)
    {
        if (!ClientScript.IsClientScriptBlockRegistered(strKey))
        {
            string strjs = "alert('" + strInfo + "');";
            ClientScript.RegisterClientScriptBlock(this.GetType(), strKey, strjs, true);
        }
    } 
}